#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-11-12 9:34 上午
# @Author  : yangdy
# @File    : 2020-11-12.922.按奇偶排序数组II
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def sortArrayByParityII(self, A: List[int]) -> List[int]:
        a1 = list(filter(lambda x: x % 2 == 1, A))
        a2 = list(filter(lambda x: x % 2 == 0, A))
        return [a1.pop() if i % 2 == 1 else a2.pop() for i in range(len(A))]

